package com.sl.happying.reading.bean;

import java.io.Serializable;
import java.sql.Clob;
import java.util.Date;

import javax.persistence.*;
import javax.sql.rowset.serial.SerialClob;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import io.swagger.annotations.ApiModelProperty;

/**
 * 每一章节的信息
 */
@Entity
@Table
public class Chapter implements Serializable {

    private static final long serialVersionUID = -717672218353371779L;

    @Id
    @GeneratedValue
    private int chapterId;

    private String chapterName;

    @Column
    private String chapterContext = new String();

    private Date entryDatetime;

    @ManyToOne(targetEntity = Novel.class)
    @JoinColumn(name = "novelId",updatable=false)
    @JsonIgnore
    private Novel novel;

    public Chapter(){

    }

    public Chapter(String chapterName, String chapterContext, Date entryDatetime) {
        this.chapterName = chapterName;
        this.chapterContext = chapterContext;
        this.entryDatetime = entryDatetime;
    }

    public String getChapterName() {
        return chapterName;
    }

    public String getChapterContext() {
        return chapterContext;
    }

    public Date getEntryDatetime() {
        return entryDatetime;
    }

    public int getChapterId() {
        return chapterId;
    }

    public void setChapterId(int chapterId) {
        this.chapterId = chapterId;
    }

    public void setChapterName(String chapterName) {
        this.chapterName = chapterName;
    }

    public void setChapterContext(String chapterContext) {
        this.chapterContext = chapterContext;
    }

    public void setEntryDatetime(Date entryDatetime) {
        this.entryDatetime = entryDatetime;
    }

    public Novel getNovel() {
        return novel;
    }

    public void setNovel(Novel novel) {
        this.novel = novel;
    }

    @Override
    public String toString() {
        return "Chapter{" +
                "chapterId=" + chapterId +
                ", chapterName='" + chapterName + '\'' +
                ", chapterContext=" + chapterContext +
                ", entryDatetime=" + entryDatetime +
                ", novel=" + novel +
                '}';
    }
}
